import yaml

#读取yaml文件
def load_yaml(file_path):
    with open(file_path, 'r', encoding='utf-8') as file:
        return yaml.safe_load(file)


class ConfigProcessor:
    def __init__(self, file_path):
        self.config = self._load_config(file_path)

    @staticmethod
    def _load_config(file_path):
        with open(file_path, 'r') as file:
            return yaml.safe_load(file)

    def process(self):
        # 直接访问类属性中的配置
        print(f"App name: {self.config['SFTP']['host']}")
        print(f"Debug mode: {self.config['SFTP']['port']}")

        # # 处理嵌套数据
        # db = self.config['database']
        # print(f"DB connection: {db['user']}@{db['host']}:{db['port']}")


if __name__ == "__main__":
    processor = ConfigProcessor("../application.yaml")
    processor.process()